import React, { useEffect, useState } from 'react';
import { NavLink } from 'react-router-dom'
import Store from './../redux/store';
const HomeView = () => {
  const [token, setToken] = useState(Store.getState().a.token)
  console.log(token)
  useEffect(() => {
    let unSubscribe = Store.subscribe(() => {
      setToken(Store.getState().a.token)
    });
  });
  return (
    <div>
      <h1>HOME ,WE ARE FAMILY</h1>
      {/*做一个导航 , to的值，如果不是以“/”开头，会自动拼接"/home", 
      NavLink默认渲染为：<a class="" href="#/home/product">产品</a>
      #，是hashRouter的样式。

      */}
      <NavLink to="/product" >产品</NavLink> | <NavLink to="/about">关于</NavLink> |
      <NavLink to="/users">用户</NavLink>
    </div>
  );
}

export default HomeView;
